home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWCollec / Include / FWNode.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-08  |  4.2 KB  |  150 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        FW_CPrivFWFWNode.h
  3.  
  4.     Contains:    Tree node class
  5.  
  6.     Written by:    Richard Rodseth
  7.  
  8.     Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <1>    10/24/94    jpa        first checked in
  13.          <3>      6/9/94    RR        Remove ASLM stuff
  14.          <1>      5/5/94    CG        first checked in
  15.          <6>     3/15/94    MB        Changes to support SCpp/ASLM builds,
  16.                                     #1150864.
  17.          <5>      2/7/94    JA        Tiger Team Makeover!
  18.          <4>    10/18/93    CG        Added #define id for ASLM
  19.          <3>      9/3/93    JBS        added SkipChildren()
  20.          <2>     7/21/93    NP        Added desctructor to FW_CPrivNode.
  21.          <1>     1/26/93    RCR        first checked in
  22.  
  23.     To Do:
  24. */
  25.  
  26. #ifndef FWNODE_H
  27. #define FWNODE_H
  28.  
  29. #ifndef FWLIST_H
  30. #include "FWList.h"
  31. #endif
  32.  
  33. #if FW_LIB_EXPORT_PRAGMAS
  34. #pragma lib_export on
  35. #endif
  36.  
  37. //=====================================================================================
  38. // Classes defined in this interface
  39. //=====================================================================================
  40.  
  41. class FW_CLASS_ATTR FW_CPrivNode;
  42. class FW_CLASS_ATTR FW_CPrivNodeTraverser;
  43.  
  44. //=====================================================================================
  45. // Classes used by this interface
  46. //=====================================================================================
  47.  
  48. class FW_CLASS_ATTR FW_CPrivLink;
  49. class FW_CLASS_ATTR FW_CPrivLinkedList;
  50.  
  51. //=====================================================================================
  52. // Typedefs and defines
  53. //=====================================================================================
  54.  
  55. typedef unsigned long FW_TraversalType;
  56. #define FW_kTopDown 1UL
  57. #define FW_kBottomUp 2UL
  58. #define FW_kChildrenOnly 3UL
  59.  
  60. typedef unsigned long FW_SiblingOrder;
  61. #define FW_kFrontToBack 1UL
  62. #define FW_kBackToFront 2UL
  63.  
  64. #ifdef GetFirstChild
  65. #undef GetFirstChild            // WindowsX.h macro
  66. #endif
  67.  
  68. #ifdef GetNextSibling
  69. #undef GetNextSibling            // WindowsX.h macro
  70. #endif
  71.  
  72. //=====================================================================================
  73. // Class FW_CPrivNode
  74. //=====================================================================================
  75.  
  76. class FW_CLASS_ATTR FW_CPrivNode : private FW_CPrivLink, private FW_CPrivLinkedList
  77. {
  78.     public:
  79.         FW_CPrivNode();
  80.         ~FW_CPrivNode();
  81.  
  82.         unsigned long Size();
  83.         
  84.         FW_CPrivNode* GetParent();
  85.         FW_CPrivNode* GetFirstChild();
  86.         FW_CPrivNode* GetLastChild();
  87.         FW_CPrivNode* GetNextSibling();
  88.         FW_CPrivNode* GetPreviousSibling();
  89.             
  90.         void SetParent(FW_CPrivNode* parent);
  91.         
  92.         void AddChildFirst(FW_CPrivNode* node);
  93.         void AddChildLast(FW_CPrivNode* node);
  94.         void AddChildBefore(FW_CPrivNode& existing, FW_CPrivNode* node);
  95.         void AddChildAfter(FW_CPrivNode& existing, FW_CPrivNode* node);
  96.         void RemoveChild(FW_CPrivNode& node);
  97.         FW_CPrivNode* GetChildAfter(FW_CPrivNode* node);
  98.         FW_CPrivNode* GetChildBefore(FW_CPrivNode* node);
  99.  
  100.         FW_CPrivNode* FirstTopDown();
  101.         FW_CPrivNode* NextTopDown(FW_SiblingOrder siblingOrder);
  102.         FW_CPrivNode* GetNextAunt(FW_SiblingOrder siblingOrder);
  103.         
  104.         FW_CPrivNode* FirstBottomUp(FW_SiblingOrder siblingOrder);
  105.         FW_CPrivNode* NextBottomUp(FW_SiblingOrder siblingOrder);
  106.  
  107.     private:
  108.         FW_CPrivNode*        fParent;
  109. };
  110.  
  111. //=====================================================================================
  112. // Class FW_CPrivNodeTraverser
  113. //=====================================================================================
  114.  
  115.  
  116. class FW_CLASS_ATTR FW_CPrivNodeTraverser 
  117. {
  118. public:
  119.  
  120.     FW_CPrivNodeTraverser(FW_CPrivNode* root, 
  121.                   FW_TraversalType traversalType, 
  122.                   FW_SiblingOrder siblingOrder);
  123.     ~FW_CPrivNodeTraverser();
  124.  
  125.     FW_CPrivNode*                First();
  126.     FW_CPrivNode*                Next();
  127.     void                SkipChildren();
  128.     FW_Boolean            IsNotComplete();
  129.  
  130. protected:    
  131.  
  132.     FW_CPrivNode* FirstTopDown(FW_CPrivNode* node);
  133.     FW_CPrivNode* NextTopDown(FW_CPrivNode* node, FW_SiblingOrder siblingOrder);
  134.     FW_CPrivNode* GetNextAunt(FW_CPrivNode* node, FW_SiblingOrder siblingOrder);
  135.     FW_CPrivNode* FirstBottomUp(FW_CPrivNode* node, FW_SiblingOrder siblingOrder);
  136.     FW_CPrivNode* NextBottomUp(FW_CPrivNode* node, FW_SiblingOrder siblingOrder);
  137.     
  138. private:
  139.       FW_CPrivNode*             fRoot;
  140.      FW_CPrivNode*             fCurrent;
  141.      FW_TraversalType fTraversalType;
  142.      FW_SiblingOrder  fSiblingOrder;
  143. };
  144.  
  145. #if FW_LIB_EXPORT_PRAGMAS
  146. #pragma lib_export off
  147. #endif
  148.  
  149. #endif // FWNODE_H
  150.